.TH std::experimental::simd::operator==,!=,,>= 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::experimental::simd::operator==,!=,,>= \- std::experimental::simd::operator==,!=,,>=

.SH Synopsis
   friend simd_mask operator==( const simd& lhs, const simd&    \fB(1)\fP (parallelism TS v2)
   rhs ) noexcept;
   friend simd_mask operator!=( const simd& lhs, const simd&    \fB(2)\fP (parallelism TS v2)
   rhs ) noexcept;
   friend simd_mask operator<( const simd& lhs, const simd& rhs \fB(3)\fP (parallelism TS v2)
   ) noexcept;
   friend simd_mask operator<=( const simd& lhs, const simd&    \fB(4)\fP (parallelism TS v2)
   rhs ) noexcept;
   friend simd_mask operator>( const simd& lhs, const simd& rhs \fB(5)\fP (parallelism TS v2)
   ) noexcept;
   friend simd_mask operator>=( const simd& lhs, const simd&    \fB(6)\fP (parallelism TS v2)
   rhs ) noexcept;

   Applies the given comparison element-wise to each corresponding element of the
   operands. Returns a simd_mask such that for all i in the range of [0, size()) the
   i^th element equals:

   1) lhs[i] == rhs[i].
   2) lhs[i] != rhs[i].
   3) lhs[i] <  rhs[i].
   4) lhs[i] <= rhs[i].
   5) lhs[i] >  rhs[i].
   6) lhs[i] >= rhs[i].

.SH Parameters

   lhs - left operands
   rhs - right operands

.SH Example


// Run this code

 #include <cassert>
 #include <iostream>
 #include <initializer_list>
 #include <iterator>

 #include <experimental/simd>
 namespace stdx = std::experimental;

 int main()
 {
     using V = stdx::fixed_size_simd<int, 4>;
     using M = stdx::fixed_size_simd_mask<int, 4>;

     auto assert_equivalence = [](M&& x, std::initializer_list<int>&& y)
     {
         for (decltype(M::size()) i{}; i != M::size(); ++i)
             assert(x[i] == std::cbegin(y)[i]);
     };

     V a{2}, b, c{3};
     b[0] = 1, b[1] = 2, b[2] = 3, b[3] = 4;

     // a == {2, 2, 2, 2}
     // b == {1, 2, 3, 4}
     // c == {3, 3, 3, 3}

     assert_equivalence(a == a, {1, 1, 1, 1});
     assert_equivalence(a == b, {0, 1, 0, 0});
     assert_equivalence(b == c, {0, 0, 1, 0});
     assert_equivalence(a == c, {0, 0, 0, 0});

     assert_equivalence(a != a, {0, 0, 0, 0});
     assert_equivalence(a != b, {1, 0, 1, 1});
     assert_equivalence(b != c, {1, 1, 0, 1});
     assert_equivalence(a != c, {1, 1, 1, 1});

     assert_equivalence(a < a, {0, 0, 0, 0});
     assert_equivalence(a < b, {0, 0, 1, 1});
     assert_equivalence(b < c, {1, 1, 0, 0});
     assert_equivalence(a < c, {1, 1, 1, 1});
 }

.SH See also

   all_of
   any_of              reductions of simd_mask to bool
   none_of             \fI(function template)\fP
   some_of
   (parallelism TS v2)
   popcount            reduction of simd_mask to the number of true values
   (parallelism TS v2) \fI(function template)\fP
   find_first_set      reductions of simd_mask to the index of the first or last true
   find_last_set       value
   (parallelism TS v2) \fI(function template)\fP
   simd_mask           data-parallel type with the element type bool
   (parallelism TS v2) \fI(class template)\fP
